package com.amazon.enums;

public enum ResultCodeEnum {

    CODE_200("请求成功", 200), CODE_400("请求参数异常", 400), CODE_404("找不到资源", 404), CODE_500("服务器异常", 500);

    private String name;
    private int reusltCode;

    ResultCodeEnum(String name, int reusltCode) {
        this.name = name;
        this.reusltCode = reusltCode;
    }

    public static String getName(int reusltCode) {
        for (ResultCodeEnum c : ResultCodeEnum.values()) {
            if (c.getResultCode() == reusltCode) {
                return c.name;
            }
        }
        return null;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getResultCode() {
        return reusltCode;
    }

    public void setResultCode(int reusltCode) {
        this.reusltCode = reusltCode;
    }
}
